home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 18 / AMIGAplus Sonderheft 18 (1999)(ICP)(DE)[!].iso / Forum / MichaelRoth / 3-3-99 / StRwAnDlEr / StRwAnDlEr.AsM < prev   
Assembly Source File  |  1998-12-29  |  5KB  |  187 lines

  1. ; Swapt groß und klein für denn EfEkT hIeR!! :-)
  2.  
  3. ;// Autor
  4. ;                            %
  5. ;                          %%*%%
  6. ;                        %%%* *%%%
  7. ;                      %%%%* B *%%%%
  8. ;                    %%%%%*  T  *%%%%%
  9. ;                  %%%%%%*   B   *%%%%%%
  10. ;                %%%%%%%*    1    *%%%%%%%
  11. ;              %%%%%%%%*     3     *%%%%%%%%
  12. ;          *%%%%%%%%%%*      M      *%%%%%%%%%%*
  13. ;        %%%%%%%%%%%%*---------------*%%%%%%%%%%%%
  14. ;       %%              A M I G A                %%
  15. ;      %%      B i l l y   T h e   B y t e        %%
  16. ;       %%        © 1997  Michael Roth           %%
  17. ;        %%%%%%%%%%%%*---------------*%%%%%%%%%%%%
  18. ;          *%%%%%%%%%%*      D      *%%%%%%%%%%*
  19. ;              %%%%%%%%*     A     *%%%%%%%%
  20. ;                %%%%%%%*    C    *%%%%%%%
  21. ;                  %%%%%%*   6   *%%%%%%
  22. ;                    %%%%%*  9  *%%%%%
  23. ;                      %%%%* 8 *%%%%
  24. ;                        %%%* *%%%
  25. ;                          %%*%%
  26. ;                            %
  27. ;\\
  28.  
  29. ;// Include
  30.           Include  assem:macro/Dir
  31.           Include  assem:macro/Exec.m
  32.           Include  assem:macro/Dos.m
  33.           Include  Dos/DosExtens.i
  34.           include  macro/filelength
  35. ;\\
  36.  
  37. ;// Libraries öffnen
  38.           OpenDos  37
  39. ;\\
  40.  
  41. ;//ReadArgs
  42.           move.l   #inputstr,d1                  ; Eingabe String
  43.           move.l   #arry,d2                      ; Arry
  44.           move.l   #0,d3                         ; Keine Externe Structur
  45.           Dos      ReadArgs                      ; Argumente Lesen
  46.           move.l   d0,rdargs                     ; speichern
  47.           bne.s    .1                            ; prüfen ob alles o.k.
  48.           error    cleanup,20                    ; o.k. >.1 Ansonsten Fehlermeldung beenden
  49. .1                                               ;
  50.           lea   arry,a0                          ; Arry nach a0
  51. ;\\
  52.  
  53. ;//File Öffnen und gröe bestimmen
  54.           move.l   (a0),d1
  55.           move.l   #MODE_OLDFILE,d2              ; 1005
  56.           Dos      Open                          ; File Öffnen
  57.           bne.s    .2
  58.           error    cleanup,20
  59. .2
  60.           move.l   d0,fh
  61.           filelength fh,filelänge                ; Filelänge bestimmen
  62. ;\\
  63.  
  64. ;// Speicher Reservieren
  65.          move.l    filelänge,d0
  66.          move.l    #MEMF_CLEAR,d1
  67.          Exec      AllocMem
  68.          move.l    d0,memblock
  69.          bne.s     .memallockok
  70.          error     cleanup,20
  71. .memallockok
  72. ;\\
  73.  
  74. ;// File einlesen
  75.          move.l   fh,d1
  76.          move.l   memblock,d2
  77.          move.l   filelänge,d3
  78.          Dos      Read
  79.          cmp.l    filelänge,d0
  80.          beq.s    .readok
  81.          error    cleanup,20
  82. .readok
  83. ;\\
  84.  
  85. ;// Kernstück
  86.          move.l    memblock,a0
  87.          move.l    filelänge,d0
  88.  
  89. ; A0 -> String
  90. ; d0 -> Länge des Strings (word)
  91.  
  92. ; d1 -  Is Needet for Flag
  93.          sub.w     #1,d0                          ;Wegen DBRA -1...
  94.          moveq     #0,d1                          ;D1 Säubern
  95.          btst      #5,(a0)                        ;Testen ob 1 Zeichen im String Groß
  96.          beq       .loop                          ;Wenn Ja LOOPEN
  97.          move.b     1,d1
  98.  
  99. .loop
  100.          cmp.b     #"A",(a0)                      ;Zeichen zwischen A und
  101.          blo.s     .next
  102.          cmp.b     #"Z",(a0)                      ;z ? Dann weiter
  103.          bhi.s     .22
  104.          bra       .go
  105. .22
  106.          cmp.b     #"a",(a0)                      ;Zeichen zwischen A und
  107.          blo.s     .next
  108.          cmp.b     #"z",(a0)                      ;z ? Dann weiter
  109.          bhi.s     .next
  110. .go
  111.          cmp.b      #1,d1
  112.          beq        .low
  113.  
  114.          move.b    #1,d1
  115.          btst      #5,(a0)
  116.          beq       .next                         ;Ist bereits Klein
  117.          bclr      #5,(a0)                       ;Klein machen
  118.          bra.s     .next
  119. .low
  120.          move.b    #0,d1
  121.          btst      #5,(a0)
  122.          bne       .next                         ;bereits Klein
  123.          bset      #5,(a0)
  124.          bra.s     .next
  125.          nop
  126. .next
  127.          lea      1(a0),a0
  128.          dbra     d0,.loop
  129. ;\\
  130.  
  131. ;// Zielfile Öffnen
  132.          lea       arry,a0                          ; Arry nach a0
  133.          move.l    4(a0),d1
  134.          move.l    #MODE_NEWFILE,d2
  135.          Dos       Open
  136.          move.l    d0,d7
  137.          bne       .ok
  138.          error     cleanup,20
  139. .ok
  140.  
  141.          move.l    d7,d1
  142.          move.l    memblock,d2
  143.          move.l    filelänge,d3
  144.          Dos       Write
  145.  
  146.          move.l    d7,d1
  147.          Dos       Close
  148. ;\\
  149.  
  150. ;// CleanUp
  151. cleanup
  152.           move.l   rdargs,d1
  153.           beq.s    .end                          ; Argumente da ?
  154.           Dos      FreeArgs                      ; Wenn Nein beenden
  155.  
  156.           move.l   fh,d1
  157.           beq.s    .1                            ; File geöffnet
  158.           Dos      Close                         ; Wenn nein weiter
  159. .1
  160.           move.l    memblock,d0
  161.           beq.s     .2
  162.           move.l    d0,a1
  163.           move.l    filelänge,d0
  164.           Exec      FreeMem
  165. .2
  166. .end
  167.           closedos
  168.           moveq    #0,d0
  169.           rts
  170. ;\\
  171.  
  172. ;// Data
  173.  DATA
  174. inputstr
  175.          dc.b      "Source/A,Dest/A",0
  176.  BSS
  177.  cnop 0,4
  178. arry     ds.l      2
  179. rdargs   ds.l      1
  180. fh       ds.l      1
  181. filelänge
  182.          ds.l      1
  183. memblock ds.l      1
  184. insert   dc.b      4,0
  185. ;\\
  186.  
  187.